Dear Users! |
Re: deleting module without any question how could I delete (with dxl script) a module without receive questions about existing incoming links to the module? |
Re: deleting module without any question vasgyuszi - Thu Mar 24 12:42:40 EDT 2011 DOORS is highly protective of the source of incoming links. The warning that DOORS gives is an important one from a Requirements Engineering methodology point of view. It's saying that you should go to the source of those links and make sure that it's OK to delete them because that might be a surprise to other users. Having said that, if you're really sure that all incoming links need to be deleted then you will need to determine which link modules contain the linkset pairs that are managing those links, then you can open those link modules and delete the linksets and the links are gone.......forever....be careful, if you get this wrong you could have an angry and rioting mob at your desk, try this out on a copy of a project first. Paul Miller Melbourne, Australia |
Re: deleting module without any question SystemAdmin - Fri Mar 25 04:20:40 EDT 2011 Paul Miller Melbourne, Australia thanks to answer me! I'm knowing about the importancy of the links and how much trouble could caused by deleting of it. I my case there is a project which is in fact a copy of an another project but with reduced content. This new smaller project will be adjusted only by scripts and no engineers will be working on it. All the developing activities run on the original big project. I wrote two scripts, one to extract the wanted content from the orig. project and another one to make the links and alot of project specific cross checks. This new project will be re-created each time, from scratch, by the script. That's the reason why I could delete all the links without any fear from damaging information. My first goal were to delete all the modules. Then I recognized DOORS warns by linked modules and suspends the script run. That's what I will avoid. The local usage of "noError / lastError" doesn't help. Is there any other solution except the exact deleting of all links by opening the modules each after each? Best regards, vasgyuszi |
Re: deleting module without any question vasgyuszi - Fri Mar 25 07:02:40 EDT 2011
vasgyuszi wrote: Is there any other solution except the exact deleting of all links by opening the modules each after each
Object o=current
Module m=current
int count=0
bool openSourceModules(Object o) {
ModName_ srcModRef
string srcModName=""
Module modSrc=null
bool allModsOpen = true
// Open all modules that are the source of incoming links in edit mode
for srcModRef in o<-"*" do {
srcModName=fullName(srcModRef)
modSrc=edit(srcModName, false)
if (null modSrc) { //provide a warning if a source cannot be opened in edit mode
infoBox "Cannot open for Edit module: " srcModName " \n\nThis script will halt execution."
allModsOpen = false
}
}
if (!allModsOpen) return false
else return true
}
void deleteIncomingLinks(Object o) {
Module modSrc=null
string srcModName=""
ModName_ srcModRef
Object objSrc
Link l
ModuleVersion sourceModVersion = null
// Delete all incoming links
for l in o<-"*" do {
objSrc = source l
sourceModVersion = sourceVersion l
srcModRef = module(sourceModVersion)
modSrc=edit(fullName(srcModRef), false)
count++
delete l
flushDeletions
save modSrc
}
} //End of deleteIncomingLinks
//***************** MAIN ********************
for o in m do {
if (!openSourceModules(o)) halt
}
for o in m do {
deleteIncomingLinks(o)
}
Paul Miller
|
Re: deleting module without any question SystemAdmin - Sun Mar 27 05:22:19 EDT 2011
vasgyuszi wrote: Is there any other solution except the exact deleting of all links by opening the modules each after each
Object o=current
Module m=current
int count=0
bool openSourceModules(Object o) {
ModName_ srcModRef
string srcModName=""
Module modSrc=null
bool allModsOpen = true
// Open all modules that are the source of incoming links in edit mode
for srcModRef in o<-"*" do {
srcModName=fullName(srcModRef)
modSrc=edit(srcModName, false)
if (null modSrc) { //provide a warning if a source cannot be opened in edit mode
infoBox "Cannot open for Edit module: " srcModName " \n\nThis script will halt execution."
allModsOpen = false
}
}
if (!allModsOpen) return false
else return true
}
void deleteIncomingLinks(Object o) {
Module modSrc=null
string srcModName=""
ModName_ srcModRef
Object objSrc
Link l
ModuleVersion sourceModVersion = null
// Delete all incoming links
for l in o<-"*" do {
objSrc = source l
sourceModVersion = sourceVersion l
srcModRef = module(sourceModVersion)
modSrc=edit(fullName(srcModRef), false)
count++
delete l
flushDeletions
save modSrc
}
} //End of deleteIncomingLinks
//***************** MAIN ********************
for o in m do {
if (!openSourceModules(o)) halt
}
for o in m do {
deleteIncomingLinks(o)
}
Paul Miller
Dear Paul, for m in p do close (m, false)
|
Re: deleting module without any question vasgyuszi - Tue Mar 29 04:54:37 EDT 2011
Dear Paul, for m in p do close (m, false)
The code was created from fragments of DXL code that I copied out of other scripts that I have - I can see why it's taking so long. It's because the deleteIncomingLinks() function is saving the source module after each link deletion, it's also wasting time re loading the source modules which should have already been opened in the openSourceModules() function.
Object o
Module m = current
Module sourceModule
Skip skpModNames = createString() //will be used to keep track of which source modules were opened
string moduleNames
string modFullName
Item i
bool openSourceModules(Object o) {
ModName_ srcModRef
string srcModFullName=""
string srcModName=""
Module modSrc=null
bool allModsOpen = true
// Open all modules that are the source of incoming links in edit mode
for srcModRef in o<-"*" do {
srcModFullName=fullName(srcModRef)
srcModName=name(srcModRef)
put(skpModNames, srcModFullName, srcModName) //record details about each opened source module in the skip list
modSrc=edit(srcModFullName, false)
if (null modSrc) { //provide a warning if a source cannot be opened in edit mode
infoBox "Cannot open for Edit module: " srcModFullName " \n\nThis script will halt execution."
allModsOpen = false
}
}
if (!allModsOpen) return false
else return true
} //end of openSourceModules()
void deleteIncomingLinks(Object o) {
Object objSrc
Link l
// Delete all incoming links
for l in o<-"*" do {
objSrc = source l
delete l
flushDeletions
}
} //End of deleteIncomingLinks()
//***************** MAIN ********************
for o in m do {
if (!openSourceModules(o)) {
delete skpModNames
halt
}
}
for o in m do {
deleteIncomingLinks(o)
}
for moduleNames in skpModNames do { //Use skip list to go back and save and close all opened source modules
modFullName = (string key skpModNames)
i = item(modFullName)
sourceModule = module(i)
save(sourceModule)
close(sourceModule)
}
delete skpModNames
Paul Miller
|
Re: deleting module without any question SystemAdmin - Tue Mar 29 20:49:45 EDT 2011
The code was created from fragments of DXL code that I copied out of other scripts that I have - I can see why it's taking so long. It's because the deleteIncomingLinks() function is saving the source module after each link deletion, it's also wasting time re loading the source modules which should have already been opened in the openSourceModules() function.
Object o
Module m = current
Module sourceModule
Skip skpModNames = createString() //will be used to keep track of which source modules were opened
string moduleNames
string modFullName
Item i
bool openSourceModules(Object o) {
ModName_ srcModRef
string srcModFullName=""
string srcModName=""
Module modSrc=null
bool allModsOpen = true
// Open all modules that are the source of incoming links in edit mode
for srcModRef in o<-"*" do {
srcModFullName=fullName(srcModRef)
srcModName=name(srcModRef)
put(skpModNames, srcModFullName, srcModName) //record details about each opened source module in the skip list
modSrc=edit(srcModFullName, false)
if (null modSrc) { //provide a warning if a source cannot be opened in edit mode
infoBox "Cannot open for Edit module: " srcModFullName " \n\nThis script will halt execution."
allModsOpen = false
}
}
if (!allModsOpen) return false
else return true
} //end of openSourceModules()
void deleteIncomingLinks(Object o) {
Object objSrc
Link l
// Delete all incoming links
for l in o<-"*" do {
objSrc = source l
delete l
flushDeletions
}
} //End of deleteIncomingLinks()
//***************** MAIN ********************
for o in m do {
if (!openSourceModules(o)) {
delete skpModNames
halt
}
}
for o in m do {
deleteIncomingLinks(o)
}
for moduleNames in skpModNames do { //Use skip list to go back and save and close all opened source modules
modFullName = (string key skpModNames)
i = item(modFullName)
sourceModule = module(i)
save(sourceModule)
close(sourceModule)
}
delete skpModNames
Paul Miller
Amazing!!! Thanks alot, dear Paul!
for m in p do {save m; close m}
for m in p do close (m, false)
|